package com.sq.universe.flowable.service;

import com.github.pagehelper.PageInfo;
import com.sq.universe.flowable.entity.WorkflowEntity;
import com.sq.universe.system.entity.UserEntity;
import org.flowable.engine.form.TaskFormData;
import org.flowable.task.api.Task;
import org.flowable.task.api.history.HistoricTaskInstance;

import java.util.List;
import java.util.Map;

public interface WorkflowService {

    /**
     * 查询待办任务
     * @param userEntity
     * @return
     */
    public PageInfo queryTodo(UserEntity userEntity, WorkflowEntity workflowEntity);

    /**
     * 根据流程实例Id获取任务
     * @param processInstanceId
     * @return
     */
    public String queryTaskId(String processInstanceId);

    /**
     * 查询全部的任务列表
     * @param userEntity
     * @return
     */
    public PageInfo taskList(UserEntity userEntity,WorkflowEntity workflowEntity);

    /**
     * 查询已完成的任务列表
     * @param userEntity
     * @return
     */
    public PageInfo queryDone(UserEntity userEntity, WorkflowEntity workflowEntity);

    /**
     * 启动任务
     * @param workflowEntity
     * @param userEntity
     */
    public void start(WorkflowEntity workflowEntity,UserEntity userEntity);

    /**
     * 完成任务
     */
    public void completeTask(WorkflowEntity workflowEntity,UserEntity userEntity);

    /**
     * 退回
     */
    public void rollback(WorkflowEntity workflowEntity, UserEntity userEntity );

    /**
     * 获取表单信息
     * @param formKey
     * @return
     */
    public TaskFormData getForm(String formKey);

    /**
     * 根据流程实例ID查询历史记录
     * @param workflowEntity
     * @return
     */
    public List history(WorkflowEntity workflowEntity);

    /**
     * 查詢任務信息
     * @param processInstanceId
     * @return
     */
    public Map<String,String> queryTaskInfo(String processInstanceId);
}
